<template>
  <j-modal :title="title" :width="600" :visible="visible" :confirmLoading="loading" switchFullscreen
    @cancel="handleCancel" @ok="handleOk">
    <a-form-model ref="ruleForm" :rules="rules" :model="form" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
      <a-form-model-item label="封堵地址" prop="fraudUrl">
        <a-input v-model="form.fraudUrl" :allowClear=true placeholder="请输入" />
      </a-form-model-item>
      <a-form-model-item label="诈骗类型" prop="fraudType">
        <a-select style="width:100%" v-model="form.fraudType">
          <a-select-option v-for="(item, key) in fraud_typeArr" :key="key" :value="item.value">
            {{ item.title }}
          </a-select-option>
        </a-select>
      </a-form-model-item>
    </a-form-model>
  </j-modal>
</template>
<script>
// import * as interviewApi from '@/api/sjsk/help/interview.js'
import { saveBlockingWhiteList } from '@/api/plugging/Police'
import { getDictItemsFromCache } from '@/api/api'
export default {
  name: 'TypeModal',
  props: ['title','label'],
  data() {
    return {
      index:111,
      fraud_typeArr:getDictItemsFromCache('case_fraud_type'),
      visible: false,
      form: {},
      loading: false,
      isAdd: true,
      rules: {
        fraudUrl: [{ required: true, message: '请输入' }],
        fraudType: [{ required: true, message: '请输入' }],
      },
    }
  },
  async created() {
  },
  methods: {
    show(type, index) {
      this.visible = true
      this.index = index
      // this.form.id = record.id
      // this.form.name = ""
      // if (type == 1) this.form.parentId = "0" //添加第一层节点
      // if (type == 2) this.form.parentId = record.key //添加下一层节点
      // if (type == 3) { //编辑节点
      //   this.isAdd = false
      //   this.form.id = record.key
      //   this.form.name = record.title
      // } else {
      //   this.isAdd = true
      // }
    },
    handleCancel() {
      this.visible = false
    },
    handleOk() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          // this.loading = true
          if(typeof(this.index) == 'number'){ 
            this.form.index = this.index
            this.$emit('delectt',this.form)
            this.visible = false
            this.form = {}
          }
          else{
            this.$emit('add',this.form)
            this.visible = false
            this.form = {}
          }
        }
      })
    }
  },
}
</script>
<style lang="less" scoped>

</style>
